﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.bandits {
    import Classes.doobers.*;

    public class BanditData {

        protected var m_id:int;
        protected var m_name:String;
        protected var m_desc:String;
        protected var m_portraitUrl:String;
        protected var m_caughtUrl:String;
        protected var m_thumbnailUrl:String;
        protected var m_doobers:Array;
        protected var m_rewardItems:Array;
        protected var m_rewardDooberTotals:Array;
        protected var m_requiredPoliceLevel:int = 2;
        protected var m_requiredCops:int = 1;

        public function BanditData(_arg1:Object){
            var _local3:XML;
            var _local4:String;
            var _local5:int;
            var _local6:String;
            this.m_doobers = [];
            this.m_rewardItems = [];
            this.m_rewardDooberTotals = [];
            super();
            if (!_arg1){
                this.m_id = -1;
                return;
            };
            this.m_id = _arg1.id;
            var _local2:XML = Global.gameSettings.getBanditDataById(this.m_id);
            if (_local2 != null){
                this.m_name = ZLoc.t("Bandits", String(_local2.text.@name));
                this.m_desc = ZLoc.t("Bandits", String(_local2.text.@description));
                this.m_portraitUrl = String(_local2.@portrait);
                this.m_caughtUrl = String(_local2.@caught);
                this.m_thumbnailUrl = String(_local2.@thumbnail);
                this.m_requiredPoliceLevel = int(_local2.@policeLevelRequired);
                this.m_requiredCops = int(_local2.@copsRequired);
                for each (_local3 in _local2.rewards.reward) {
                    _local4 = String(_local3.@type);
                    if (((!((_local4 == Doober.DOOBER_COLLECTABLE))) && (!((_local4 == Doober.DOOBER_ITEM))))){
                        _local5 = int(_local3.@value);
                        _local6 = Global.gameSettings.getDooberFromType(_local4, _local5, BanditManager.SECURE_RAND_FEATURE_NAME);
                        this.m_doobers.push([_local6, _local5]);
                        if (this.m_rewardDooberTotals[_local4] == null){
                            this.m_rewardDooberTotals[_local4] = 0;
                        };
                        this.m_rewardDooberTotals[_local4] = (this.m_rewardDooberTotals[_local4] + _local5);
                    } else {
                        if (_local4 == Doober.DOOBER_ITEM){
                            this.m_rewardItems.push(String(_local3.@value));
                        };
                    };
                };
            };
        }
        public function get id():int{
            return (this.m_id);
        }
        public function get requiredPoliceLevel():int{
            return (this.m_requiredPoliceLevel);
        }
        public function get requiredCops():int{
            return (this.m_requiredCops);
        }
        public function get name():String{
            return (this.m_name);
        }
        public function get description():String{
            return (this.m_desc);
        }
        public function get portraitUrl():String{
            return (this.m_portraitUrl);
        }
        public function get caughtUrl():String{
            return (this.m_caughtUrl);
        }
        public function get thumbnail():String{
            return (this.m_thumbnailUrl);
        }
        public function get doobers():Array{
            return (this.m_doobers);
        }
        public function get rewardItems():Array{
            return (this.m_rewardItems);
        }
        public function get rewardDooberTotals():Array{
            return (this.m_rewardDooberTotals);
        }
        public function wasCaptured():Boolean{
            if (BanditManager.typesBanditsCaptured[this.id] == null){
                return (false);
            };
            return (true);
        }

    }
}//package Modules.bandits 
